<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>

</body>
<script>
  //  数组转字符串
  // var arr = ["a","b","c","d"];
  // var str = arr.join("-");
  // console.log(str);

  // split(char)  用特定的字符将字符串拆分为数组  => 返回数组
  // var str ="good good study , day day up"; 
  // var arr = str.split(" ");
  // console.log(arr);  //["good", "good", "study", ",", "day", "day", "up"]

  // var arr = str.split(""); //将字符串查分为单个字符
  // console.log(arr); 


  // 字母大小写转换
  // toUpperCase()   字符串转大写
  // toLowerCase()   字符串转小写
  // 返回新字符串

  // var str = "Good gOOd Study 123123 哈哈";
  // var str1 = str.toUpperCase();
  // console.log(str1);

  // var str = "Good gOOd Study 123123 哈哈";
  // var str1 = str.toLowerCase();
  // console.log(str1);

  // trim()       去除首尾空格
  // trimLeft()   去除头部空格
  // trimright()  去除尾部空格
  var str = "         111111111           ";
  console.log(1, str);

  var result = str.trim();
  console.log(1, result);

  var result = str.trimLeft();
  console.log(1, result);

  var result = str.trimRight();
  console.log(1, result);

  // 去除所有空格
  var str = "         11  111      1111           ";
  var reg = / /g;
  var butify = str.replace(reg, "");
  console.log(1, butify);



</script>

</html>